<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * MAPI COA Project
 * coa.php
 * @author ranuandra
 *
 * 22 Jul 2011
 * tags
 */
class Model_Coa extends ORM
{
		protected $_belongs_to = array(
									'productspec' 	=> array('model' => 'productspec'),
								);

	private $field = array(
						'cu','si',
						'fe',
						'zn',
						'mn',
						'mg',
						'ni',
						'ti',
						'pb',
						'sn',
						'cr',
						'ca',
						'bi',
						'pbe',
						'cd',
						'al',
						'h2gas',
						'sludge',
						'kvalues',
						'productspec_id',
						'charge_id',
					);
					
	private $form = array(
						'cu' 				=> '',
						'si' 				=> '',
						'fe' 				=> '',
						'zn' 				=> '',
						'mn' 				=> '',
						'mg' 				=> '',
						'ni' 				=> '',
						'ti' 				=> '',
						'pb' 				=> '',
						'sn' 				=> '',
						'cr' 				=> '',
						'ca' 				=> '',
						'bi' 				=> '',
						'pbe' 				=> '',
						'cd' 				=> '',
						'al' 				=> '',
						'h2gas' 				=> '',
						'sludge' 				=> '',
						'kvalues' 				=> '',
						'productspec_id' 				=> '',
						'charge_id' 				=> '',
					);
					
					
	public function rules()
	{
		return array(

						'cu' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'si' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'fe' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'zn' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'mn' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'mg' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'ni' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'ti' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'pb' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'sn' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'cr' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'ca' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'bi' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'pbe' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'cd' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'al' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'h2gas' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'sludge' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'kvalues' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
						'productspec_id' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),
			 			'charge_id' 				=>  array(
			 										array('min_length', array(':value', 0)),
			 									),

		);
	}
	
	public function getForm()
	{
		return $this->form;
	}
	
	public function getField()
	{
		return $this->field;
	}
	
	public function create_data($values)
	{
		return $this->values($values, $this->field)->create();
	}
}